package com.dingreading.cloud.mall.service.impl;

import com.dingreading.cloud.mall.entity.NjTicketUser;
import com.dingreading.cloud.mall.entity.table.NjTicketUserTableDef;
import com.dingreading.cloud.mall.mapper.NjTicketUserMapper;
import com.dingreading.cloud.mall.service.NjTicketUserService;
import com.mybatisflex.core.update.UpdateChain;
import org.springframework.stereotype.Service;

/**
 *  服务层实现。
 *
 * @author Administrator
 * @since 2024-12-23
 */
@Service
public class NjTicketUserServiceImpl extends BaseServiceImpl<NjTicketUserMapper, NjTicketUser, NjTicketUserTableDef> implements NjTicketUserService {

    @Override
    protected NjTicketUserTableDef getTable() {
        return NjTicketUserTableDef.njTicketUser;
    }


    @Override
    public void upGradeTicketType(String userUid, String year) {
        UpdateChain.of(NjTicketUser.class)
                .set(table.ticketType, 1)
                .set(table.ticketTypeName, "参会票")
                .set(table.userType, "参会人员")
                .set(table.paymentStatus, 1)
                .set(table.paymentStatusName, "已付款")
                .set(table.permitNum, 1)
                .where(table.uid.eq(userUid).and(table.year.eq(year)))
                .update();
    }
}
